----------------------------------------------------------------------------------------------
 1
       
#define PAUSE 250
#include <tiny2313.h> 

void main(void)
{

        unsigned char   Cnt=0, 
                        Rev=0,
                        Dl=0, 
                        DlFl=0;

        // Crystal Oscillator division factor: 1
        #pragma optsize-
        CLKPR=0x80;
        CLKPR=0x00;
        #ifdef _OPTIMIZE_SIZE_
        #pragma optsize+
        #endif
        // Port B initialization
        // Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out 
        // State7=1 State6=1 State5=1 State4=1 State3=1 State2=1 State1=1 State0=1 
        PORTB=0xFF;
        DDRB=0xFF;

        while (1)
        {
                if (Dl==(unsigned char)PAUSE) {DlFl=1; Dl=0;} else Dl++;
                switch(DlFl)
                {
                        case 1: if(Rev==255) Rev=0;
                                        else Rev++;
                                DlFl=0;
                        break;
                        case 0: 
                                if (Cnt==255)Cnt=0;
                                if((Cnt>Rev)||(Cnt==Rev)) PORTB.0=0;
                                        else              PORTB.0=1;
                                Cnt++;
                        break;
                };
        };
}

-------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------
 1 

#define PAUSE 250
#include <tiny2313.h> 

void main(void)
{
        unsigned char   Cnt=0, 
                        Rev=0,
                        Dl=0; 
        bit DlFl1=0, 
            DlFl2=0;

        // Crystal Oscillator division factor: 1
        #pragma optsize-
        CLKPR=0x80;
        CLKPR=0x00;
        #ifdef _OPTIMIZE_SIZE_
        #pragma optsize+
        #endif
        // Port B initialization
        // Func7=Out Func6=Out Func5=Out Func4=Out Func3=Out Func2=Out Func1=Out Func0=Out 
        // State7=1 State6=1 State5=1 State4=1 State3=1 State2=1 State1=1 State0=1 
        PORTB=0xFF;
        DDRB=0xFF;

        while (1)
        {
                if ((Dl==(unsigned char)PAUSE)&&(DlFl1==0)) 
                {
                        DlFl1=1; 
                        Dl=0;
                }
                else if((Dl==(unsigned char)PAUSE)&&(DlFl1==1))
                {
                        DlFl1=0;
                        DlFl2=1;
                        Dl=0;
                }
                else Dl++;
                switch(DlFl2)
                {
                        case 1: if(Rev==255) Rev=0;
                                        else Rev++;
                                DlFl2=0;
                        break;
                        case 0: 
                                if (Cnt==255)Cnt=0;
                                if((Cnt>Rev)||(Cnt==Rev)) PORTB.0=0;
                                        else              PORTB.0=1;
                                Cnt++;
                        break;
                };
        };
}
------------------------------------------------------------------------------------------------------------------------

------------------------------------------------------------------------------------------------------------------------
 2

------------------------------------------------------------------------------------------------------------------------